//
//  MCVIPCenterCollectionViewCell.m
//  TLYL
//
//  Created by MC on 2017/11/22.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import "MCVIPCenterCollectionViewCell.h"
#import "MCDataTool.h"
#import "MCContractMgtTool.h"

@interface MCVIPCenterCollectionViewCell ()
@property (nonatomic,strong)UILabel *lab_1;
@property (nonatomic,strong)UIImageView * imgVLogo;
@property (nonatomic,strong)UILabel *lab_2;

@end

@implementation MCVIPCenterCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self){
        [self initView];
    }
    return self;
}

-(void)setDataSource:(MCGetUserVipInfoDataModel *)dataSource{
    
    _dataSource=dataSource;
    
    if (!dataSource||dataSource==nil) {
        return;
    }
    NSString * VsID = [NSString stringWithFormat:@"%@",dataSource.VsID];
    NSInteger t_VsID =[VsID integerValue];
    if (t_VsID==0) {
        return;
    }
    
    if (_cellTag==1) {
        _lab_2.text=GetRealSNum(dataSource.BetMoney);
    }else if (_cellTag==2){

        _lab_2.text=GetRealSNum(dataSource.UpgradeMoney);//晋升礼金
    }else if (_cellTag==3){

        _lab_2.text=GetRealSNum(dataSource.KeepMoney);//维持礼金
    }else if (_cellTag==4){

        _lab_2.text=[MCContractMgtTool getPercentNumber:dataSource.ComfortMoney];//负盈利安慰金
    }else if (_cellTag==5){
        NSString *DrawingNum=[NSString stringWithFormat:@"%@",dataSource.DrawingNum];
        if ([DrawingNum isEqualToString:@"-1"]) {
            _lab_2.text=@"无限制";//专属提款次数 (-1 无限制)
        }else{
            _lab_2.text=[NSString stringWithFormat:@"%@次",dataSource.DrawingNum];
        }
        
    }else if (_cellTag==6){
        NSString *HeadPortrait=[NSString stringWithFormat:@"%@",dataSource.HeadPortrait];
        if ([HeadPortrait integerValue]==0) {
            _lab_2.text=@"--";//专用头像 （true 代表有，false 代表无）
        }else{
            [self setHeadPortrait:t_VsID];//专用头像 （true 代表有，false 代表无）
        }
    }else if (_cellTag==7){
        NSString *CustomerService=[NSString stringWithFormat:@"%@",dataSource.CustomerService];
        if ([CustomerService integerValue]==0) {
            _lab_2.text=@"无";//专属客服 （true 代表有，false 代表无）
        }else{
            _lab_2.text=@"有";//专属客服 （true 代表有，false 代表无）
        }
    }else if (_cellTag==8){

        _lab_2.text=dataSource.DrawingMoney;//专属取款额度
    }else if (_cellTag==9){
        NSString *Domainame=[NSString stringWithFormat:@"%@",dataSource.Domainame];
        if ([Domainame integerValue]==0) {
            _lab_2.text=@"无";//专用域名 （true 代表有，false 代表无）
        }else{
            _lab_2.text=@"有";//专用域名 （true 代表有，false 代表无）
        }
    }
}

-(void)setHeadPortrait:(NSInteger)t_VsID{
    if (t_VsID==1){
        _lab_2.text = @"青铜";
    }else if (t_VsID==2){
        _lab_2.text = @"白银";
    }else if (t_VsID==3){
        _lab_2.text = @"黄金";
    }else if (t_VsID==4){
        _lab_2.text = @"铂金";
    }else if (t_VsID==5){
        _lab_2.text = @"钻石";
    }else if (t_VsID==6){
        _lab_2.text = @"王者";
    }
}
-(void)setCellTag:(NSInteger)cellTag{
    
    _cellTag = cellTag;
    
    if (cellTag==1) {
        _imgVLogo.image=[UIImage imageNamed:@"vip_1_byyxtzl"];
        _lab_1.text=@"半月有效投注量";
    }else if (cellTag==2){
        _imgVLogo.image=[UIImage imageNamed:@"vip_2_jslj"];
        _lab_1.text=@"晋升礼金";
    }else if (cellTag==3){
        _imgVLogo.image=[UIImage imageNamed:@"vip_3_wclj"];
        _lab_1.text=@"维持礼金";
    }else if (cellTag==4){
        _imgVLogo.image=[UIImage imageNamed:@"vip_4_fylaw"];
        _lab_1.text=@"负盈利安慰奖";
    }else if (cellTag==5){
        _imgVLogo.image=[UIImage imageNamed:@"vip_5_qkcs"];
        _lab_1.text=@"取款次数";
    }else if (cellTag==6){
        _imgVLogo.image=[UIImage imageNamed:@"vip_6_zsxz"];
        _lab_1.text=@"专属勋章";
    }else if (cellTag==7){
        _imgVLogo.image=[UIImage imageNamed:@"vip_7_zskf"];
        _lab_1.text=@"专属客服";
    }else if (cellTag==8){
        _imgVLogo.image=[UIImage imageNamed:@"vip_8_qked"];
        _lab_1.text=@"取款额度";
    }else if (cellTag==9){
        _imgVLogo.image=[UIImage imageNamed:@"vip_9_zsym"];
        _lab_1.text=@"专属域名";
    }
}

-(void)initView{
    
    self.backgroundColor=[UIColor whiteColor];
    
    
    _imgVLogo=[[UIImageView alloc]init];
    [self addSubview:_imgVLogo];
    [_imgVLogo mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.centerY.equalTo(self.mas_centerY);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(40);
    }];

    _lab_1 =[[UILabel alloc]initWithFrame:CGRectZero];
    _lab_1.font=[UIFont systemFontOfSize:14];
    _lab_1.textColor=RGB(136,136,136);
    _lab_1.text =@"--";
    _lab_1.textAlignment=NSTextAlignmentCenter;
    [self  addSubview:_lab_1];
    [_lab_1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(20);
        make.left.and.right.equalTo(self);
        make.bottom.equalTo(_imgVLogo.mas_top).offset(-5);
        
    }];
    
    _lab_2 =[[UILabel alloc]initWithFrame:CGRectZero];
    _lab_2.font=[UIFont systemFontOfSize:14];
    _lab_2.textColor=RGB(46,46,46);
    _lab_2.text =@"--";
    _lab_2.textAlignment=NSTextAlignmentCenter;
    [self  addSubview:_lab_2];
    [_lab_2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(20);
        make.left.and.right.equalTo(self);
        make.top.equalTo(_imgVLogo.mas_bottom).offset(5);
        
    }];
    
}
- (void)setSelected:(BOOL)selected{

}


+(CGFloat)computeHeight:(id)info{
    
    CGFloat W = (G_SCREENWIDTH-2)/3.0;
    return W;
}
@end





































